# 进程 自定义
from multiprocessing import Process
from time import sleep

class MyProcess(Process):
    
    def __init__(self, name):
        super(MyProcess, self).__init__(name=name)

    # 重写run方法
    def run(self):
        n = 1
        while True:
            # print('进程名字:', self.name)
            sleep(1)
            print('{}--->自定义进程n：{}'.format(self.name, n))
            n += 1

number = 0
if __name__ == '__main__':
    p = MyProcess("张三")
    p.start()

    while True:
        number += 1
        sleep(0.1)
        # print('-----------------------m:', m)
        if number == 50:
            p.terminate()
            break